﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessLayer;
using System.Web.Security;

namespace Design
{
    public partial class WebForm15 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Page_Init(object sender, EventArgs e)
        {
            ListView1.ItemCommand += new EventHandler<ListViewCommandEventArgs>(ListView1_ItemCommand);
        }

        void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                lblid.Text = "You clicked the " + (String)e.CommandArgument + " button";

                MembershipUser user = Membership.GetUser();
                CartItem objitem = new CartItem();

                objitem.equipid = e.CommandArgument.ToString();
                objitem.userid = user.ProviderUserKey.ToString().ToUpper();

                objitem.save_item();
            }
            else
            {
                Response.Redirect("~/Login.aspx");
            }
        }
    }
}